package com.kucai.yifaqapp.presenter.activity;

import com.kucai.yifaqapp.global.HttpAdress;
import com.kucai.yifaqapp.model.CustomObserver;
import com.kucai.yifaqapp.model.network.HttpJsonUtils;
import com.kucai.yifaqapp.model.network.entity.res.ResNote;
import com.kucai.yifaqapp.ui.activity.NoteActivity;

import io.reactivex.android.schedulers.AndroidSchedulers;
import io.reactivex.disposables.Disposable;
import io.reactivex.schedulers.Schedulers;

/**
 * Created by Administrator on 2018/11/29.
 */

public class NoteActivityPresenter extends BaseActivityPresenter<NoteActivity> {
    public NoteActivityPresenter(NoteActivity mActivity) {
        super(mActivity);
    }

    /**
     * 即时注单
     */
    public void getnote(String token) {
        HttpJsonUtils.getHttpApiInstance()
                .getnote(HttpAdress.getuseAdress() + "api/m/lottery/getNotcount",token)
                .subscribeOn(Schedulers.io())
                .observeOn(AndroidSchedulers.mainThread())
                .subscribe(new CustomObserver<ResNote>(mActivity) {
                    @Override
                    protected void onSubscribeCustom(Disposable disposable) {
                    }

                    @Override
                    protected void onErrorCustom(Throwable e) {

                    }

                    @Override
                    protected void onCustomNext(ResNote resNote) {
                        if (0 == resNote.code && null != resNote.data) {
                            mActivity.Noteget(resNote);
                        }
                    }
                });
    }

//    public void getnote2(String token) {
//        HttpJsonUtils.getHttpApiInstance()
//                .getnote(token)
//                .subscribeOn(Schedulers.io())
//                .observeOn(AndroidSchedulers.mainThread())
//                .subscribe(new CustomObserver<ResLottery>() {
//                    @Override
//                    protected void onCustomNext(ResLottery resLottery) {
//
//                    }
//                });
//    }

}
